package com.msk86.ygoroid.newaction.dueldisk.dispatcherimpl;

import com.msk86.ygoroid.newaction.Action;
import com.msk86.ygoroid.newaction.Dispatcher;
import com.msk86.ygoroid.newaction.dueldisk.actionimpl.RotateMonsterPositionAction;
import com.msk86.ygoroid.newcore.Container;
import com.msk86.ygoroid.newcore.Controllable;
import com.msk86.ygoroid.newcore.constant.FieldType;
import com.msk86.ygoroid.newcore.impl.Field;
import com.msk86.ygoroid.newop.impl.Press;

import java.util.ArrayList;
import java.util.List;

public class PressDispatcher implements Dispatcher<Press> {
    @Override
    public List<Action> dispatch(Press op) {
        List<Action> actionChain = new ArrayList<Action>();
        Container container = op.getContainer();
        if(container instanceof Field) {
            Field field = (Field) container;
			if(op.getItem() instanceof Controllable && (field.getType() == FieldType.MONSTER || field.getType() == FieldType.EX_MONSTER)) {
				actionChain.add(new RotateMonsterPositionAction(op));
            }

        }
        return actionChain;
    }
}
